package fz.vrd.ui.dialog;

import android.view.Gravity;
import android.view.View;

import fz.vrd.ui.R;


/**
 * <b>类名称或说明：相机和相册的对话框  <br/>
 * <b>创建人： Administrator <br/>
 * <b>时间： 2019/5/5 11:57<br/>
 * <b>修改备注：{ } <br/>
 */
public class PhotoAndCameraDialog extends BaseDialogFragment {

    PhotoClickListern listern;

    @Override
    public int getLayoutId() {
        return R.layout.lib_ui_photo_dialog;
    }

    @Override
    public boolean getCancelable() {
        return true;
    }

    @Override
    public float getDimAmount() {
        return 0.2f;
    }

    @Override
    public int getDailogGravity() {
        return Gravity.BOTTOM;
    }

    @Override
    public void initView() {
        findViewById(R.id.btn_dialog_photo_cancle).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (listern != null) listern.listern(0);
                dismiss();
            }
        });
        findViewById(R.id.btn_dialog_photo).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (listern != null) listern.listern(2);
                dismiss();
            }
        });
        findViewById(R.id.btn_dialog_canmer).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (listern != null) listern.listern(1);
                dismiss();
            }
        });
    }

    public void setOnClickListener(PhotoClickListern listern) {
        this.listern = listern;
    }

    public interface PhotoClickListern {

        /**
         * @param index 从下往上,从0开始
         */
        void listern(int index);
    }

}
